Skip to content
This repository was archived by the owner on Jan 14, 2024. It is now read-only.

London Class 7 - Hozan Ali - JavaScript-Core-1-Coursework - Week 1#52

Closed
Hozan94 wants to merge 3 commits into
CodeYourFuture:masterfrom
Hozan94:master
Closed

London Class 7 - Hozan Ali - JavaScript-Core-1-Coursework - Week 1#52
Hozan94 wants to merge 3 commits into
CodeYourFuture:masterfrom
Hozan94:master

Conversation

@Hozan94
Copy link
Copy Markdown

@Hozan94 Hozan94 commented Jan 22, 2021

Solving all question in the 'exercise' and 'mandatory' folders.

Your Details

  • Your Name: Hozan Ali
  • Your City: London Class 7
  • Your Slack Name: Hozan Ali

Homework Details

  • Module: javaScript-core-1
  • Week: 1

Solving all question in the 'exercise' and 'mandatory' folders.
Comment on lines +2 to +4
var myName = "Hozan";
var nameLength = myName.length;
var message = "My name is " + myName + " and my name is " + nameLength + " characters long";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great Hozan! As a challenge, you can make use of template literals. This link: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals and video: https://youtu.be/NgF9-pdTDGs are quite useful should you need them.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback Omar, the documents you provided looks great, I already went through them and found some useful info, I want to also note that in some exercises I did apply template literals, while in others I left them to have string literlas just so I practice how to use them both. Many Thanks

@@ -1,3 +1,4 @@
const name = " Daniel ";
var message = "My name is " + name.trim() + " and my name is " + name.length + " characters long";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very well done on your work Hozan, impressive!
only one very personal suggestion, you could have used a variable to hold the trimmed value and then use it. That would had simplify your code. Now is a bit compacted, which again, is a personal choice. I read it better on multiple lines.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks @Domenico-cyf for your feedback, I will consider such thing next time, as I was only trying to minimize my code.

return Math.random() * 10;
}
// The function above will return a random integer from 0 and 9, The random() method returns a random number from 0 (inclusive) up to but not including 1 (exclusive)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Hozan, when if you run Math.random what output do you get? If you multiple the result of Math.random with 10 does it result in an integer?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @louisechow , many thanks for the feedback.
You are right, I should have worded my answer properly.
The Math.random method will return a floating point number between 0 and 1 (not included), and when it is multiplied by 10 we will still get a floating point number between 0 and 10 (not included).

Comment thread mandatory/3-function-output.js Outdated
function s(w1, w2) {
return w1.concat(w2);
}
// The concat() method above is used to join two or more strings, so the function will return a new string of w1 + w2.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function s only has 2 arguments, so you can't join more than 2 strings.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@louisechow you are right, I should be careful with how I write my answer, in that particual example it will only be used to concatenate the two parameters w1 and w2.

@louisechow
Copy link
Copy Markdown

Great work Hozan! 👏

@github-actions
Copy link
Copy Markdown

Your coursework submission has been closed because nobody has interacted with it in 30 days. You are welcome to re-open it to get more feedback.

@github-actions github-actions Bot added the Stale label May 13, 2021
@github-actions github-actions Bot closed this May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants